package ch18._11;

public class Solution {
    public static void find(int[][] matrix) {
	int n = matrix.length;
	Square[][] dp = new Square[n][n];
	dp[0][0] = new Square(matrix[0][0]);
	for (int i = 1; i < n; i++) {
	    if (matrix[i][0] == 1) {
		dp[i][0] = new Square(dp[i-1][0], 1, 0);
	    }
	    if (matrix[0][i] == 1) {
		dp[0][i] = new Square(dp[0][i-1], 0, 1);
	    }
	}
	int max = 0;
	for (int i = 1; i < n; i++) {
	    for (int j = 1; j < n; j++) {
		if (matrix[i][j] == 1) {
		dp[i][j] = new Square(dp[i-1][j].top + 1,
				      dp[i][j-1].left + 1);
		if (Math.min(dp[i][j].top, dp[i][j].left) > max) {
		    int min = Math.min(dp[i][j].top, dp[i][j].left);
		    if (dp[i-min][j].left >= dp[i][j].left
			}
	    }
	}
    }
}

class Square {
    int top;
    int left;
    public Square(int t, int l) {
	top = t;
	left = l;
    }

    public Square(int n) {
	top = n;
	left = n;
    }

    public Square(Square s, int topInc, int leftInc) {
	top = s.top + topInc;
	left = s.left + leftInc;
    }
}